num_list=[]
for i in range(100):
    num_list.append(i)
print(num_list)

num_list=[i for i in range(100)]
print(num_list)
print('-'*50)
# 两层for循环
a=[j for i in range(5)for j in range(i)]
print(a)

a=[[col*row for col in range(5)]for row in range(5)]
print(a)

b=[i for j in a for i in j]
print(b)


print('-'*50)
c=[x for x in range(10) if x%2==0] #偶数
print(c)
c=[x for x in range(10) if x%2==1] #奇数
print(c)

# if else三元表达式----如果是偶数留着，不是偶数部分统统平方
a=[x if x%2==0 else x**2 for x in range (10)]
print(a)